package xjh.him.netty.codec;

import com.alibaba.fastjson.JSON;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Packet {
    byte command;
    String data;

    public static Packet create(Class<?> clazz, Object req) {
        return new Packet(Command.getCommand(clazz), JSON.toJSONString(req));
    }
}
